package com.hymall.service.wx;

import com.hymall.bean.MarketAdmin;
import com.hymall.bean.MarketFeedback;
import com.hymall.mapper.MarketAdminMapper;
import com.hymall.mapper.MarketFeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author: 牟治宇
 * @description 反馈中心实现类
 * @date: 2022/7/19 9:44
 */

@Service
public class
FeedbackServiceImpl implements FeedbackService {


    @Autowired
    MarketFeedbackMapper marketFeedbackMapper;

    @Autowired
    MarketAdminMapper marketAdminMapper;

    @Override
    public void insertFeedback(MarketFeedback marketFeedback,Integer userId) {

        // marketFeedbackMapper.
        // marketFeedback.setUserId();
        // marketFeedback.setUsername(marketFeedback.getUsername());
        MarketAdmin marketAdmin = marketAdminMapper.selectByPrimaryKey(userId);
        marketFeedback.setUsername(marketAdmin.getUsername());
        marketFeedback.setUserId(userId);
        marketFeedback.setAddTime(new Date(System.currentTimeMillis()));
        marketFeedback.setUpdateTime(marketFeedback.getAddTime());
        int code = marketFeedbackMapper.insertSelective(marketFeedback);

    }
}
